home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Interfaces / Universal Interfaces 2.0a3 / Universal AIncludes / MixedMode.a < prev    next >
Encoding:
Text File  |  1994-11-11  |  6.2 KB  |  219 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        MixedMode.a
  3. ;
  4. ;    Copyright:    © 1984-1994 by Apple Computer, Inc.
  5. ;                All rights reserved.
  6. ;
  7. ;    Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8. ;
  9. ;    Bugs?:        If you find a problem with this file, send the file and version
  10. ;                information (from above) and the problem description to:
  11. ;
  12. ;                    Internet:    apple.bugs@applelink.apple.com
  13. ;                    AppleLink:    APPLE.BUGS
  14. ;
  15. ;
  16.  
  17.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  18. __MIXEDMODE__ SET 1
  19.  
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24. ;        include 'ConditionalMacros.a'                                ;
  25.  
  26. kRoutineDescriptorVersion        EQU        7
  27.  
  28. ; MixedModeMagic Magic Cookie/Trap number 
  29. _MixedModeMagic                    EQU        $AAFE
  30.  
  31. ; Calling Conventions 
  32. kPascalStackBased                EQU        0
  33. kCStackBased                    EQU        1
  34. kRegisterBased                    EQU        2
  35. kD0DispatchedPascalStackBased    EQU        8
  36. kD1DispatchedPascalStackBased    EQU        12
  37. kD0DispatchedCStackBased        EQU        9
  38. kStackDispatchedPascalStackBased EQU        14
  39. kThinkCStackBased                EQU        5
  40.  
  41. ; ISA Types 
  42. kM68kISA                        EQU        0
  43. kPowerPCISA                        EQU        1
  44.  
  45. ; RTA Types 
  46. kOld68kRTA                        EQU        (0 << 4)
  47. kPowerPCRTA                        EQU        (0 << 4)
  48. kCFM68kRTA                        EQU        (1 << 4)
  49.  
  50. kRegisterD0                        EQU        0
  51. kRegisterD1                        EQU        1
  52. kRegisterD2                        EQU        2
  53. kRegisterD3                        EQU        3
  54. kRegisterD4                        EQU        8
  55. kRegisterD5                        EQU        9
  56. kRegisterD6                        EQU        10
  57. kRegisterD7                        EQU        11
  58. kRegisterA0                        EQU        4
  59. kRegisterA1                        EQU        5
  60. kRegisterA2                        EQU        6
  61. kRegisterA3                        EQU        7
  62. kRegisterA4                        EQU        12
  63. kRegisterA5                        EQU        13
  64. kRegisterA6                        EQU        14
  65. ; A7 is the same as the PowerPC SP 
  66. kCCRegisterCBit                    EQU        16
  67. kCCRegisterVBit                    EQU        17
  68. kCCRegisterZBit                    EQU        18
  69. kCCRegisterNBit                    EQU        19
  70. kCCRegisterXBit                    EQU        20
  71.  
  72. ; SizeCodes we use everywhere 
  73. kNoByteCode                        EQU        0
  74. kOneByteCode                    EQU        1
  75. kTwoByteCode                    EQU        2
  76. kFourByteCode                    EQU        3
  77.  
  78. ; Mixed Mode Routine Records 
  79. ; Routine Flag Bits 
  80. kProcDescriptorIsAbsolute        EQU        $00
  81. kProcDescriptorIsRelative        EQU        $01
  82.  
  83. kFragmentIsPrepared                EQU        $00
  84. kFragmentNeedsPreparing            EQU        $02
  85.  
  86. kUseCurrentISA                    EQU        $00
  87. kUseNativeISA                    EQU        $04
  88.  
  89. kPassSelector                    EQU        $0
  90. kDontPassSelector                EQU        $08
  91.  
  92. kRoutineIsNotDispatchedDefaultRoutine EQU        $0
  93. kRoutineIsDispatchedDefaultRoutine EQU        $10
  94.  
  95. RoutineRecord             RECORD    0
  96. procInfo                 ds.l    1                                    ; calling conventions 
  97. reserved1                 ds.b    1                                    ; Must be 0 
  98. ISA                         ds.b    1                                    ; Instruction Set Architecture 
  99. routineFlags             ds.w    1                                    ; Flags for each routine 
  100. procDescriptor             ds.l    1                                    ; Where is the thing we’re calling? 
  101. reserved2                 ds.l    1                                    ; Must be 0 
  102. selector                 ds.l    1                                    ; For dispatched routines, the selector 
  103. sizeof                     EQU    20
  104.                         ENDR
  105.  
  106. ; Mixed Mode Routine Descriptors 
  107. ; Definitions of the Routine Descriptor Flag Bits 
  108.  
  109. kSelectorsAreNotIndexable        EQU        $00
  110. kSelectorsAreIndexable            EQU        $01
  111.  
  112. ; Routine Descriptor Structure 
  113. RoutineDescriptor         RECORD    0
  114. goMixedModeTrap             ds.w    1                                    ; Our A-Trap 
  115. version                     ds.b    1                                    ; Current Routine Descriptor version 
  116. routineDescriptorFlags     ds.b    1                                    ; Routine Descriptor Flags 
  117. reserved1                 ds.l    1                                    ; Unused, must be zero 
  118. reserved2                 ds.b    1                                    ; Unused, must be zero 
  119. selectorInfo             ds.b    1                                    ; If a dispatched routine, calling convention, else 0 
  120. routineCount             ds.w    1                                    ; Number of routines in this RD 
  121. routineRecords             ds        RoutineRecord                        ; The individual routines 
  122. sizeof                     EQU    32
  123.                         ENDR
  124.  
  125.  
  126. ; Calling Convention Offsets 
  127. kCallingConventionWidth            EQU        4
  128. kCallingConventionPhase            EQU        0
  129. kCallingConventionMask            EQU        $F
  130. ; Result Offsets 
  131. kResultSizeWidth                EQU        2
  132. kResultSizePhase                EQU        kCallingConventionWidth
  133. kResultSizeMask                    EQU        $30
  134. ; Parameter offsets & widths 
  135. kStackParameterWidth            EQU        2
  136. kStackParameterPhase            EQU        (kCallingConventionWidth + kResultSizeWidth)
  137. kStackParameterMask                EQU        $FFFFFFC0
  138. ; Register Result Location offsets & widths 
  139. kRegisterResultLocationWidth    EQU        5
  140. kRegisterResultLocationPhase    EQU        (kCallingConventionWidth + kResultSizeWidth)
  141. ; Register Parameter offsets & widths 
  142. kRegisterParameterWidth            EQU        5
  143. kRegisterParameterPhase            EQU        (kCallingConventionWidth + kResultSizeWidth + kRegisterResultLocationWidth)
  144. kRegisterParameterSizePhase        EQU        0
  145. kRegisterParameterSizeWidth        EQU        2
  146. kRegisterParameterWhichPhase    EQU        kRegisterParameterSizeWidth
  147. kRegisterParameterWhichWidth    EQU        3
  148. ; Dispatched Stack Routine Selector offsets & widths 
  149. kDispatchedSelectorSizeWidth    EQU        2
  150. kDispatchedSelectorSizePhase    EQU        (kCallingConventionWidth + kResultSizeWidth)
  151. ; Dispatched Stack Routine Parameter offsets 
  152. kDispatchedParameterPhase        EQU        (kCallingConventionWidth + kResultSizeWidth + kDispatchedSelectorSizeWidth)
  153. ; Special Case offsets & widths 
  154. kSpecialCaseSelectorWidth        EQU        6
  155. kSpecialCaseSelectorPhase        EQU        kCallingConventionWidth
  156. kSpecialCaseSelectorMask        EQU        $3F0
  157. ; Component Manager Special Case offsets & widths 
  158. kComponentMgrResultSizeWidth    EQU        2
  159. kComponentMgrResultSizePhase    EQU        kCallingConventionWidth + kSpecialCaseSelectorWidth ; 4 + 6 = 10 
  160. kComponentMgrParameterWidth        EQU        2
  161. kComponentMgrParameterPhase        EQU        kComponentMgrResultSizePhase + kComponentMgrResultSizeWidth ; 10 + 2 = 12 
  162.  
  163. kSpecialCase                    EQU        $0000000F
  164.  
  165. ; all of the special cases enumerated.  The selector field is 6 bits wide 
  166. kSpecialCaseHighHook            EQU        0
  167. kSpecialCaseCaretHook            EQU        0                    ; same as kSpecialCaseHighHook 
  168. kSpecialCaseEOLHook                EQU        1
  169. kSpecialCaseWidthHook            EQU        2
  170. kSpecialCaseTextWidthHook        EQU        2                    ; same as kSpecialCaseWidthHook 
  171. kSpecialCaseNWidthHook            EQU        3
  172. kSpecialCaseDrawHook            EQU        4
  173. kSpecialCaseHitTestHook            EQU        5
  174. kSpecialCaseTEFindWord            EQU        6
  175. kSpecialCaseProtocolHandler        EQU        7
  176. kSpecialCaseSocketListener        EQU        8
  177. kSpecialCaseTERecalc            EQU        9
  178. kSpecialCaseTEDoText            EQU        10
  179. kSpecialCaseGNEFilterProc        EQU        11
  180. kSpecialCaseMBarHook            EQU        12
  181. kSpecialCaseComponentMgr        EQU        13
  182.  
  183.     IF GENERATINGCFM  THEN
  184.     IF GENERATING68K THEN
  185.         Macro
  186.         _NewRoutineDescriptor
  187.             moveq    #0,d0
  188.             dc.w     $AA59
  189.         EndM
  190.     ELSE
  191.         IMPORT    NewRoutineDescriptor
  192.     ENDIF
  193.  
  194.     IF GENERATING68K THEN
  195.         Macro
  196.         _DisposeRoutineDescriptor
  197.             moveq    #1,d0
  198.             dc.w     $AA59
  199.         EndM
  200.     ELSE
  201.         IMPORT    DisposeRoutineDescriptor
  202.     ENDIF
  203.  
  204.     IF GENERATING68K THEN
  205.         Macro
  206.         _NewFatRoutineDescriptor
  207.             moveq    #2,d0
  208.             dc.w     $AA59
  209.         EndM
  210.     ELSE
  211.         IMPORT    NewFatRoutineDescriptor
  212.     ENDIF
  213.  
  214.     ELSE
  215.     ENDIF
  216.     IF CFMSYSTEMCALLS  THEN
  217.     ENDIF
  218.     ENDIF ; __MIXEDMODE__
  219.